package org.mindrive.system.web;

import org.mindrive.system.core.MindriveException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;

@Component
public class BaseController {

	@Value("${file.path}")
	public String destPath;

	protected void validParams(BindingResult bindingResult) {
		if (bindingResult.hasErrors()) {
			FieldError fieldError = bindingResult.getFieldError();
			throw new MindriveException(fieldError.getDefaultMessage());
		}
	}
}
